/*
 * @Author: Wangjun
 * @Date: 2023-09-20 18:51:33
 * @LastEditTime: 2023-10-10 13:19:01
 * @LastEditors: Wangjun
 * @Description:关系库的组态算子
 * @FilePath: \xr_node_calc\models\node_task.go
 * hnxr
 */
package models

const sqlCkTask = `CREATE TABLE IF NOT EXISTS node_task
(
    id Int32,
    exec_time DateTime,
    write_time DateTime DEFAULT now(),
    parent String COMMENT '父画布',
    category String COMMENT '维度',
    file_name String COMMENT '文件名',
    crc String COMMENT '版本识别号',
    data String,
    value Decimal(18, 2),
    bad Int8
)
ENGINE = ReplacingMergeTree
PARTITION BY toYYYYMMDD(exec_time)
PRIMARY KEY (exec_time,category,file_name, id)
ORDER BY (exec_time,category,file_name, id)
TTL exec_time + toIntervalMonth(24)
SETTINGS index_granularity = 8192;`

type NodeTask struct {
	ID       int     //关联ID
	CRC      string  `gorm:"crc"` //版本
	Parent   string  //父画布
	FileName string  //文件名
	Category string  //关联类别
	ExecTime int64   //执行时间
	Data     string  //数据
	Value    float64 //值
	Bad      int8    //是否坏点
}
